package com.example.springcustompropertiessample;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

@Configuration
@EnableConfigurationProperties
@PropertySource(value = "classpath:application.properties",encoding = "utf-8")
public class UserConfig {

    @Value("${custom.name}")
    private String name ;

    @Bean
    public User dataSource(){
        User user = new User(name);

        return user;
    }
}
